package com.ubao.network.req;

import java.io.File;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;

import com.ubao.network.RequestInterface;

public class SpecialRequest implements RequestInterface {
    public String url;

    public boolean needEncoding = true;

    public String encoding = "utf-8";

    public String encoding_cm = "UTF-8";

    // public boolean isNewLine = false;

    public short msg_id;

    public String postParams;

    public Hashtable requestProperties;
    
    public String boundary;
    
    public Map<String, File> files;

    public SpecialRequest(String url) {
        this.url = url;
    }

    public SpecialRequest(String url, boolean needEncoding) {
        this.url = url;
        this.needEncoding = needEncoding;
    }

    public byte[] getContent() {
        if (postParams != null)
            return postParams.getBytes();

        return null;
    }

    public String getUrl() {
        return url;
    }

    public int getContentLength() {
        return postParams == null ? 0 : postParams.length();
    }

    public Hashtable getRequestProperty() {
        return requestProperties;
    }

    @Override
    public List<RequestInterface> getSubRequests() {
        return null;
    }

    @Override
    public byte getType() {
        return RequestInterface.TYPE_SPECIAL;
    }

	@Override
	public Map<String, File> getFiles() {
		// TODO Auto-generated method stub
		return files;
	}

	@Override
	public String getBoundary() {
		return boundary;
	}
}
